using B.S.Domain.审计字段;
using B.S.Domain.基础数据.客户管理;
using B.S.Domain.Ticket;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;

namespace B.S.Domain.InvoiceManagement
{
    /// <summary>
    /// 销售发票主表
    /// 用于存储销售订单对应的发票基本信息
    /// </summary>
    public class SalesInvoice : BaseModel
    {
        /// <summary>
        /// 发票主键ID
        /// </summary>
        [Key]
        public int InvoiceId { get; set; }

        /// <summary>
        /// 发票编号
        /// 系统生成或手动录入的发票唯一编号
        /// </summary>
        public string InvoiceNo { get; set; }

        /// <summary>
        /// 关联的订单ID
        /// 外键，关联到DingDan表
        /// </summary>
        public int OrderId { get; set; }

        /// <summary>
        /// 订单导航属性
        /// 用于实体框架Core的关系映射
        /// </summary>
        public virtual DingDan Order { get; set; }

        /// <summary>
        /// 客户ID
        /// 外键，关联到client表
        /// </summary>
        public int CustomerId { get; set; }

        /// <summary>
        /// 客户导航属性
        /// 用于实体框架Core的关系映射
        /// </summary>
        public virtual client Customer { get; set; }

        /// <summary>
        /// 发票金额
        /// 发票的总金额
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal InvoiceAmount { get; set; }

        /// <summary>
        /// 开票日期
        /// 发票开具的日期
        /// </summary>
        public DateTime InvoiceDate { get; set; }

        /// <summary>
        /// 发票类型
        /// 如：增值税专用发票、增值税普通发票等
        /// </summary>
        public string InvoiceType { get; set; }

        /// <summary>
        /// 发票状态
        /// 0：待开具，1：已开具，2：已作废，3：已红冲
        /// </summary>
        public int InvoiceStatus { get; set; }

        /// <summary>
        /// 税率
        /// 发票适用的税率
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal TaxRate { get; set; }

        /// <summary>
        /// 税额
        /// 发票包含的税额
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal TaxAmount { get; set; }

        /// <summary>
        /// 不含税金额
        /// 发票不含税的总金额
        /// </summary>
        public decimal SubtotalAmount { get; set; }

        /// <summary>
        /// 备注信息
        /// 发票相关的备注信息
        /// </summary>
        public string Remarks { get; set; }

        /// <summary>
        /// 发票明细导航属性
        /// 一对多关系，一个发票可以有多个发票明细
        /// </summary>
        public virtual ICollection<SalesInvoiceDetail> InvoiceDetails { get; set; }

        /// <summary>
        /// 到票信息导航属性
        /// 一对多关系，一个发票可以有多个到票记录
        /// </summary>
        public virtual ICollection<InvoiceReceipt> Receipts { get; set; }
    }
}